$(() => {
  let $width          = $('#width'),
      $height         = $('#height'),
      //$btnCal         = $('#calc'),
      $form           = $('#main'),
      $perimeter      = $('#perimeter'),
      $widthValidate  = $('#width-validate'),
      $heightValidate = $('#height-validate'),
      $area           = $('#area');

  //$btnCal.click(()=> {
  $form.submit(()=>{
    e.preventDefault();
    let w = Number($width.val()),
        h = Number($height.val());

    let p=(w+h)*2,
        a=w*h;

    $perimeter.val(p);
    $area.val(a); 
  }
})

